AddPrefabPostInit("marble", function(inst)
    if not TheWorld.ismastersim then
        return inst
    end
    inst:AddComponent("_ymh_marble_caneat")
end)

-- 恶龙血铠:吃大理石加三点固定防御，最多叠加到10层 固定防御（包括位面伤害）
AddComponentPostInit('combat',function (self)
    local old_GetAttacked = self.GetAttacked
    function self:GetAttacked(attacker,damage,weapon,stimuli,spdamage,...)
        if self.inst.components.ymh_eat_marble then
            local val = self.inst.components.ymh_eat_marble:GetBuffSpecificValue()
            if val and val>0 then
                if damage then
                    damage = math.max(0,damage - val)
                end
                if spdamage then
                    if spdamage['planar'] then
                        spdamage['planar'] = math.max(0,spdamage['planar'] - val)
                    end
                end
            end
        end
        return old_GetAttacked(self,attacker,damage,weapon,stimuli,spdamage,...)
    end
end)

